package com.huawei.hwCloudJs.service.hms;

import android.content.Intent;
import android.util.Log;
import com.huawei.hms.support.api.hwid.HuaweiId;
import com.huawei.hms.support.api.hwid.SignInResult;
import com.huawei.hwCloudJs.core.JsCallback;
import com.huawei.hwCloudJs.service.hms.a.b;
import com.huawei.hwCloudJs.service.hms.a.c;

final class HmsCoreApi$a implements c {
    private JsCallback a;
    private boolean b;

    public HmsCoreApi$a(JsCallback jsCallback, boolean z) {
        this.a = jsCallback;
        this.b = z;
    }

    public void a(b bVar) {
        Intent a = bVar.a();
        if (a != null) {
            SignInResult signInResultFromIntent = HuaweiId.HuaweiIdApi.getSignInResultFromIntent(a);
            if (signInResultFromIntent == null) {
                Log.e("HmsCoreApi", "JS signIn onResult signInResult is null");
                this.a.failure("signInResult is null");
            } else if (signInResultFromIntent.isSuccess()) {
                Log.i("HmsCoreApi", "JS signIn onResult isSuccess");
                this.a.success(b.a(signInResultFromIntent, this.b));
            } else {
                Log.e("HmsCoreApi", "JS signIn onResult" + signInResultFromIntent.getStatus().getStatusCode());
                this.a.failure(signInResultFromIntent.getStatus().getStatusCode());
            }
        } else if (bVar.b() != -1) {
            Log.e("HmsCoreApi", "JS signIn onResult JS_RET_CODE_USER_DENAL");
            this.a.failure(1);
        } else {
            Log.e("HmsCoreApi", "JS signIn onResult hms not ret data");
            this.a.failure("hms not ret data");
        }
    }
}
